<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="SecurityLinkUp.test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript">
    var elementuid;
    
    function ShowPopup(uid)
    {    
        elementuid = uid;
        SecurityLinkUp.WebServices.HelloWorld("test",SucceededCallback, FailedCallback);
        //UserProfilePopup.GetUserProfilePopupHTML(uid, SucceededCallback, FailedCallback);
        //SucceededCallback("<p><b>XXX</b></p>");
    }
  
    function SucceededCallback(result)
    {
        var itm = document.getElementById(elementuid);
        var xy = findPos(itm);
        var popup = document.getElementById("userprofilepopup");
        
        popup.innerHTML = result;
        
        popup.style.top = xy[1];
        popup.style.left = xy[0] + 100;
        popup.style.visibility = "Visible";    
    }
    
    function FailedCallback(error)
    {
        SucceededCallBack("Error in getting user profile!");
    }
    
    function HidePopup(uid)
    {
        var popup = document.getElementById("userprofilepopup");
        popup.style.visibility = "Hidden";
    }
    
    function findPos(obj) 
    {
	    var curleft = curtop = 0;
	    if (obj.offsetParent) {
		    curleft = obj.offsetLeft
		    curtop = obj.offsetTop
		    while (obj = obj.offsetParent) {
			    curleft += obj.offsetLeft
			    curtop += obj.offsetTop
		    }
	    }
	    return [curleft,curtop];
    }


</script>

    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" id="ScriptManager1"> 
            <Services> 
                <asp:ServiceReference Path="~/WebServices.asmx" InlineScript="true"/> 
            </Services> 
        </asp:ScriptManager>
        
        <input id="Button1" type="button" value="button" onclick="ShowPopup('Button1');" />
        
        <div id="userprofilepopup" style="visibility:hidden; position:absolute; top:0; left:0; width:100px; height:100px"></div>

    </form>
</body>
</html>
